package org.autocode.code;

import org.autocode.code.type.*;

import java.sql.Types;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @program: autocode
 * @description:
 * @author: zhu.xiaojie
 * @create: 2020-08-20 00:26
 */
public class MysqlJavaMapping {

    private static final ConcurrentHashMap<Integer , JavaType> DATA = new ConcurrentHashMap<>();

    static {
        DATA.put(Types.INTEGER , new JavaInteger());
        DATA.put(Types.BIGINT , new JavaLong());
        DATA.put(Types.DATE , new JavaDate());
        DATA.put(Types.TIMESTAMP , new JavaDate());
        DATA.put(Types.VARCHAR , new JavaString());
        DATA.put(Types.LONGVARCHAR , new JavaString());
        DATA.put(Types.TINYINT , new JavaBoolean());


    }


    public static JavaType getJavaType(int type){
        return DATA.get(type);
    }

}
